package com.tuanzi.loan.business.service.family.impl;

import com.tuanzi.loan.business.entity.family.LoanLargeAmountNewPartnerInfo;
import com.tuanzi.loan.business.repository.family.LoanLargeAmountNewPartnerInfoRepository;
import com.tuanzi.loan.business.service.family.LoanLargeAmountNewPartnerInfoService;
import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.core.repository.JPAAuditRepository;
import com.tuanzi.loan.core.service.BaseAuditServiceImpl;
import com.tuanzi.loan.core.vo.PageSearcher;
import com.tuanzi.loan.vo.request.Collaborate.LargeAmountNewPartnerRequest;
import com.tuanzi.loan.vo.response.collaborate.LargeAmountNewPartnerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.retry.RetryException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * User: liangZongXi
 * Create time: 11:11 2019/8/21
 * Description:
 */

@Debug
@Service
@Transactional
@Retryable(value = { RetryException.class })
public class LoanLargeAmountNewPartnerInfoServiceImpl extends BaseAuditServiceImpl<LoanLargeAmountNewPartnerInfo, Long> implements LoanLargeAmountNewPartnerInfoService {

    private final LoanLargeAmountNewPartnerInfoRepository loanLargeAmountNewPartnerInfoRepository;

    @Autowired
    public LoanLargeAmountNewPartnerInfoServiceImpl(LoanLargeAmountNewPartnerInfoRepository loanLargeAmountNewPartnerInfoRepository) {
        this.loanLargeAmountNewPartnerInfoRepository = loanLargeAmountNewPartnerInfoRepository;
    }

    @Override
    public Page<LargeAmountNewPartnerResponse> list(PageSearcher<LargeAmountNewPartnerRequest> pageSearcher) {
        return loanLargeAmountNewPartnerInfoRepository.list(pageSearcher.getSearchCondition(), pageSearcher.getPageable());
    }

    @Override
    protected JPAAuditRepository<LoanLargeAmountNewPartnerInfo, Long> getRepository() {
        return loanLargeAmountNewPartnerInfoRepository;
    }

    @Override
    public LoanLargeAmountNewPartnerInfo findAllByPartnerAccount(String partnerAccount) {
        return loanLargeAmountNewPartnerInfoRepository.findAllByPartnerAccount(partnerAccount);
    }
}
